<?php

// phpMyRealty 3
//
// File Name: alertscontrol.php
// File Location : ./
//
// Copyright (c)2009 phpMyRealty.com
//
// e-mail: support@phpMyRealty.com

// Include configuration file and general functions
define('PMR', 'true');

include ( './config.php' );
include ( PATH . '/defaults.php' );

// ----------------------------------------------------------------------
// LISTING ALERTS CONTROL SECTION

// Title tag content
$title = $conf['website_name_short'] . ' - ' . $lang['Alert'];

// Template header
include ( PATH . '/templates/' . $cookie_template . '/header.php' );

echo table_header ( $lang['Information'] );

if (isset($_GET['req']) && $_GET['req'] == 'approve' && $_GET['code'] != '')
 {

  $sql = 'UPDATE '. ALERTS_TABLE .
        ' SET approved = 1 WHERE code = "' . safehtml($_GET['code']) . '" LIMIT 1';

  $db->query($sql) or error ('Critical Error', mysql_error ());

  echo $lang['Alert_Approved'];

 }

if (isset($_GET['req']) && $_GET['req'] == 'unsubscribe' && $_GET['code'] != '')
 {

  $sql = 'DELETE FROM '. ALERTS_TABLE .
        ' WHERE code = "' . safehtml($_GET['code']) . '" LIMIT 1';

  $db->query($sql) or error ('Critical Error', mysql_error ());

  echo $lang['Alert_Unsubscribed'];

 }

echo table_footer ( );

// Template footer
include ( PATH . '/templates/' . $cookie_template . '/footer.php' );

?>